<?php
$cars = array("Volvo", "BMW", "Toyota");
sort($cars);
print_r($cars);
echo "sort()对数组进行升序";
echo "<br>";
?>


<?php
$numbers = array(4, 6, 2, 22, 11);
sort($numbers);
print_r($numbers);
echo "sort()对数组进行升序";
echo "<br>";
?>

<?php
$cars = array("Volvo", "BMW", "Toyota");
rsort($cars);
print_r($cars);
echo "rsort()对数组进行降序排列";
echo "<br>";
?>


<?php
$numbers = array(4, 6, 2, 22, 11);
rsort($numbers);
print_r($numbers);
echo "rsort()对数组进行降序排列";
echo "<br>";
?>

<?php
$numbers = array("peter" => "35", "ben" => "37", "joe" => "43");
asort($numbers);
print_r($numbers);
echo "asort()根据数组的值，对数组进行升序排序";
echo "<br>";
?>

<?php
$numbers = array("peter" => "35", "ben" => "37", "joe" => "43");
ksort($numbers);
print_r($numbers);
echo "ksort() - 根据数组的键，对数组进行升序排列";
echo "<br>";
?>

<?php
$numbers = array("peter" => "35", "ben" => "37", "joe" => "43");
arsort($numbers);
print_r($numbers);
echo "arsort() - 根据数组的值，对数组进行降序排列";
echo "<br>";
?>

<?php
$numbers = array("peter" => "35", "ben" => "37", "joe" => "43");
krsort($numbers);
print_r($numbers);
echo "krsort() - 根据数组的键，对数组进行降序排列";
echo "<br>";
?>